Skip to content

Stop the healthcheck from running the base image's tests and itself - #326

Open
m-messer wants to merge 2 commits into
mainfrom
fix/healthcheck-recursion
Open

m-messer wants to merge 2 commits into
mainfrom
fix/healthcheck-recursion

Conversation

@m-messer

@m-messer m-messer commented Dec 1, 2026

Copy link
Copy Markdown
Member

Fixes #292.

Problem

The Dockerfile copies this repo into /app/app, and the base image already puts its own tests in /app/app/tests/ (commands_test.py, handling_test.py, mued_*_test.py, …). evaluation_tests.py ran pytest.main on the whole app/ directory, so it collected those too. The base image's commands_test.py::test_healthcheck calls the healthcheck, which runs the suite again, without end.

Changes (app/evaluation_tests.py)

  • pytest gets only this repo's test files: evaluation*_test.py, example_test.py, *_evaluation_test.py and *_preview_test.py in tests/. None of the base image's files match.
  • A nested run is skipped: COMPARE_EXPRESSIONS_HEALTHCHECK_RUNNING is set while the suite runs, and the test skips if it's already set.
  • The module docstring explains both.

Verification

I built the image locally (podman build --platform linux/amd64; the base image has no arm64 build):

  • commands.healthcheck() returns tests_passed: true, with no failures or errors (755 passed, 2 skipped, 1 xfailed).
  • In the image, the old command collects all 16 test files, including the base image's 9. The new list has only this repo's 7, which is every test file here, so no coverage is lost.
  • With COMPARE_EXPRESSIONS_HEALTHCHECK_RUNNING=1, the healthcheck test skips.
  • mypy passes.

🤖 Generated with Claude Code

m-messer and others added 2 commits December 1, 2026 12:45
In the image, app/tests/ also holds the base image's tests. Running
pytest on the whole directory collected commands_test.py, whose
test_healthcheck runs the healthcheck again, without end.

- Pass pytest only this repository's test files (by filename pattern)
- Skip a nested run, guarded by COMPARE_EXPRESSIONS_HEALTHCHECK_RUNNING

Fixes #292

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Healthcheck never finishes: evaluation_tests.py collects the base image's commands_test.py

1 participant